<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<script type="text/javascript">
	function queryStudent() {
		$("#student-table-div").load("/teach/selectStudents", {
			pageNo:1,
			grade:$("#student-grade").val(),
			major:$("#student-major").val()
		})
	}
	
	function add2Teacher(studentId) {
		$.ajax({
			url:"/teach/saveRelation",
			type:"post",
			data:{
				"teacherStudent.student_id":studentId,
				"teacherStudent.teacher_id":"${teacherId}"
			},
			dataType:"json"
		}).done(function(data){
			myalert(data.msg);
		})
	}
</script>
<section role="main" id="main">
	<input type="hidden" id="teacherId" value="${teacherId }">

	<noscript class="message black-gradient simpler">Your browser does not support JavaScript! Some features won't work as expected...</noscript>

	<hgroup id="main-title" class="thin">
		<h1>学生列表</h1>
	</hgroup>

	<div class="with-padding">
	<div>
		<div class="columns">
			<div class="three-column">
				<p class="inline-small-label button-height">
					<label for="small-label-1" class="label">年级</label>
					<select id="student-grade" class="select">
						<option value="">--请选择--</option>
						<c:forEach items="${grades }" var="grade">
							<option value="${grade.value }">${grade.name }</option>
						</c:forEach>
					</select>
				</p>
			</div>
			<div class="three-column">
				<p class="inline-small-label button-height">
					<label for="small-label-1" class="label">专业</label>
					<select id="student-major" class="select">
						<option value="">--请选择--</option>
						<c:forEach items="${majors }" var="major">
							<option value="${major.value }">${major.name }</option>
						</c:forEach>
					</select>
				</p>
			</div>
			<div class="three-column">
				<p class="inline-small-label button-height">
					<button class="button blue-gradient glossy" onclick="queryStudent();">查询</button>
				</p>
			</div>
		</div>
		
		<div id="student-table-div">
			<jsp:include page="select_student_table.jsp"/>	
		</div>
	</div>
	</div>
</section>